package cn.tedu.baking.controller;

import cn.tedu.baking.pojo.Emp;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import java.lang.reflect.Array;
import java.util.ArrayList;
import java.util.Arrays;

/**
 * @Author: XiaZheng
 * @Date: 2024/3/21 9:44
 * @Description: 测试Controller
 */
//@Component
@RestController
@Slf4j
public class TestController {
    @RequestMapping("/hello")
    public String hello() {
        log.info("hello");
        return "Hello.html";
    }
    @RequestMapping("/name")
    public String index(@RequestParam("name") String name) {
        log.info("index");
        return "index.html"+name;
    }

    @RequestMapping("/emp")
    public Emp emp(Emp emp,@RequestParam String name) {
        log.info("emp");
        return emp;
    }

    //传入数组
    @RequestMapping("/empArray")
    public String empArray(@RequestBody Integer[] ids) {
        log.info("empArray");
        return Arrays.toString(ids);
    }
}
